package com.yht.weblog.admin.controller;

import com.yht.weblog.admin.service.AdminDashboardService;
import com.yht.weblog.common.aspect.ApiOperationLog;
import com.yht.weblog.common.utils.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: yht
 * @date: 2024/1/28 11:17
 * @description: Admin 仪表盘模块
 **/
@RestController
@RequestMapping("/admin/dashboard")
@Api(tags = "Admin 仪表盘模块")
public class AdminDashboardController {
    @Autowired
    private AdminDashboardService adminDashboardService;
    /**
     * 查询仪表盘统计信息
     *
     * @return Response对象
     */
    @PostMapping("/statistics")
    @ApiOperation(value = "查询仪表盘统计信息")
    @ApiOperationLog(description = "查询仪表盘统计信息")
    public Response findDashboardStatistics(){
        return adminDashboardService.findDashboardStatistics();
    }
    /**
     * 查询文章发布热点统计信息
     *
     * @return Response对象
     */
    @PostMapping("/publishArticle/statistics")
    @ApiOperation(value = "查询文章发布热点统计信息")
    @ApiOperationLog(description = "查询文章发布热点统计信息")
    public Response findDashboardPublishArticleStatistics(){
        return adminDashboardService.findDashboardPublishArticleStatistics();
    }
    /**
     * 查询 PV 统计信息
     *
     * @return Response对象
     */
    @PostMapping("/pv/statistics")
    @ApiOperation(value = "获取后台仪表盘最近一周 PV 访问量信息")
    @ApiOperationLog(description = "获取后台仪表盘最近一周 PV 访问量信息")
    public Response findDashboardPVStatistics(){
        return adminDashboardService.findDashboardPVStatistics();
    }
}
